import type { ArticleDetail } from '@/types/article'
import type { PublishReqParams } from '@/types/publish'
import { http } from '@/utils/http'

/**
 * 发布文章
 */
export const publishArticleApi = (draft: boolean, data: PublishReqParams) => {
  return http.post<null>('/v1_0/mp/articles?draft=' + draft, data)
}
/**
 * 获取文章详情
 */
export const getArticleDetailApi = (id: string) => {
  return http.get<ArticleDetail>('/v1_0/mp/articles/' + id)
}
/**
 * 修改文章
 */
export const updateArticleApi = (id: string, draft: boolean, data: PublishReqParams) => {
  return http.put<null>(`/v1_0/mp/articles/${id}?draft=${draft}`, data)
}
